<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="layui/css/layui.css" rel="stylesheet">
    <script src="layui/layui.js"></script>

</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">券商Id</label>
        <div class="layui-input-block" style="width: 182px">
            <input type="text" id="brokerId" name="brokerId" required  lay-verify="required" placeholder="请输入券商id" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">券商名称</label>
        <div class="layui-input-block" style="width: 182px">
            <input type="text" id="brokerName" name="brokerName" required  lay-verify="required" placeholder="请输入券商名称" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">券商说明</label>
        <div class="layui-input-block" style="width: 182px">
            <input type="text" id="brokerDesc" name="brokerDesc" required  lay-verify="required" placeholder="请输入券商说明" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">券商备注</label>
        <div class="layui-input-block" style="width: 182px">
            <input type="text" id="brokerIntroduce" name="brokerIntroduce" required  lay-verify="required" placeholder="请输入券商备注" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="updatebroker">修改券商</button>
            <button type="reset" class="layui-btn layui-btn-primary" style="background-color: orange; color:aliceblue">重置</button>
        </div>
    </div>
</form>
<!--修改数据的Ajax-->
<script type="text/javascript">
    layui.use('form',function (){
        var form = layui.form;
        var $ = layui.jquery;
        form.on('submit(updatebroker)',function(obj){
            console.log(obj.field);
            $.ajax({

                url:"updateBroker",
                type:"get",
                data:obj.field,
                dataType:"text",
                contentType:"application/x-www-form-urlencoded",//内容类型  form 表单的
                success:function(msg){
                    if(msg=="修改成功"){
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    }
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    })
</script>
</body>
</html>